package com.zyf.heixiang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyf.heixiang.entity.User;
import com.zyf.heixiang.mapper.UserMapper;
import com.zyf.heixiang.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author DL5O
 * @version 1.0
 */
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    /**
     * 查询手机号为phone的用户
     * @param phone 手机号
     * @return
     */
    @Override
    public User getByPhone(String phone) {
        LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
        qw.eq(User::getPhone,phone);
        User user= this.getOne(qw);
        return user;
    }

}
